@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ |
||
| 7 | 7 |
from pai2.basemodels import CreateUpdateMixin |
| 8 | 8 |
from utils.redis.rgroup import get_group_photo_thumbup_flag |
| 9 | 9 |
from utils.redis.rorder import get_lensman_order_record |
| 10 |
-from utils.url_utils import img_url |
|
| 10 |
+from utils.url_utils import img_url, share_url |
|
| 11 | 11 |
|
| 12 | 12 |
|
| 13 | 13 |
r = settings.REDIS_CACHE |
@@ -183,6 +183,10 @@ class GroupPhotoInfo(CreateUpdateMixin): |
||
| 183 | 183 |
return img_url(self.photo_thumbnail2_path) |
| 184 | 184 |
|
| 185 | 185 |
@property |
| 186 |
+ def photo_share_url(self): |
|
| 187 |
+ return share_url(self.pk) |
|
| 188 |
+ |
|
| 189 |
+ @property |
|
| 186 | 190 |
def photo_data(self): |
| 187 | 191 |
return {
|
| 188 | 192 |
'photo_id': self.pk, |
@@ -212,6 +216,7 @@ class GroupPhotoInfo(CreateUpdateMixin): |
||
| 212 | 216 |
'photo_thumbnail2_url': self.photo_thumbnail2_url, |
| 213 | 217 |
'photo_thumbnail2_w': self.photo_thumbnail2_w, |
| 214 | 218 |
'photo_thumbnail2_h': self.photo_thumbnail2_h, |
| 219 |
+ 'photo_share_url': self.photo_share_url, |
|
| 215 | 220 |
'user_id': self.user_id, |
| 216 | 221 |
'nickname': self.nickname, |
| 217 | 222 |
'avatar': self.avatar, |
@@ -29,7 +29,7 @@ from utils.redis.rkeys import (GROUP_LAST_PHOTO_PK, GROUP_USERS_APPLYING_SET, GR |
||
| 29 | 29 |
from utils.redis.rorder import get_lensman_order_record |
| 30 | 30 |
from utils.sql.raw import PAI2_HOME_API |
| 31 | 31 |
from utils.thumbnail_utils import make_thumbnail |
| 32 |
-from utils.url_utils import img_url |
|
| 32 |
+from utils.url_utils import img_url, share_url |
|
| 33 | 33 |
|
| 34 | 34 |
|
| 35 | 35 |
r = settings.REDIS_CACHE |
@@ -910,6 +910,7 @@ def pai2_home_api(request): |
||
| 910 | 910 |
'photo_thumbnail2_url': img_url(row[12]), |
| 911 | 911 |
'photo_thumbnail2_w': row[13], |
| 912 | 912 |
'photo_thumbnail2_h': row[14], |
| 913 |
+ 'photo_share_url': share_url(row[5]), # Warning: Index of This Line is 5 |
|
| 913 | 914 |
'user_id': row[15], |
| 914 | 915 |
'nickname': row[16], |
| 915 | 916 |
'avatar': row[17], |
@@ -989,6 +990,11 @@ def lensman_photo_bought(request): |
||
| 989 | 990 |
}) |
| 990 | 991 |
|
| 991 | 992 |
|
| 993 |
+def group_photo_detail(request, photo_id): |
|
| 994 |
+ photo = GroupPhotoInfo.objects.get(pk=photo_id) |
|
| 995 |
+ return render(request, 'photo/photo_detail.html', {'photo_url': photo.photo_url})
|
|
| 996 |
+ |
|
| 997 |
+ |
|
| 992 | 998 |
def group_detail(request, group_id): |
| 993 | 999 |
return render(request, 'page/download.html', {})
|
| 994 | 1000 |
|
@@ -55,7 +55,11 @@ urlpatterns += [ |
||
| 55 | 55 |
] |
| 56 | 56 |
|
| 57 | 57 |
urlpatterns += [ |
| 58 |
- url(r'^g/(?P<group_id>\w+)$', group_views.group_detail, name='group_detail'), # Group 详情(APP下载页) |
|
| 58 |
+ url(r'^gp/(?P<photo_id>\w+)$', group_views.group_photo_detail, name='group_photo_detail'), # 群组照片详情 |
|
| 59 |
+] |
|
| 60 |
+ |
|
| 61 |
+urlpatterns += [ |
|
| 62 |
+ url(r'^g/(?P<group_id>\w+)$', group_views.group_detail, name='group_detail'), # 群组详情(APP下载页) |
|
| 59 | 63 |
] |
| 60 | 64 |
|
| 61 | 65 |
urlpatterns += [ |
@@ -5,3 +5,7 @@ from django.conf import settings |
||
| 5 | 5 |
|
| 6 | 6 |
def img_url(img_path): |
| 7 | 7 |
return u'{}/{}'.format(settings.IMG_DOMAIN, img_path) if img_path else ''
|
| 8 |
+ |
|
| 9 |
+ |
|
| 10 |
+def share_url(photo_id): |
|
| 11 |
+ return u'{}/gp/{}'.format(settings.DOMAIN, photo_id) if photo_id else ''
|